package Competition;

public class isSubstringPresent {
    public static void main(String[] args) {
        String s = "ausoee";
        isSubstringPresent isSubstringPresent = new isSubstringPresent();
        System.out.println(isSubstringPresent.isSubstringPresent(s));
    }
    public boolean isSubstringPresent(String s) {
        if(s.length() < 2)
            return false;
        String rev = reverse(s);
        System.out.println(rev.toString());
        int count = 0;
        while (count < s.length() - 1){
            String temp = "" + s.charAt(count) + s.charAt(count+1);
            if(rev.contains(temp))
                return true;
            count++;
        }
        return false;
    }
    public String reverse(String s){
        char[] rev = s.toCharArray();
        int left = 0,right = s.length() - 1;
        while (left < right){
            char temp = rev[left];
            rev[left] = rev[right];
            rev[right] = temp;
            left++;
            right--;
        }
        return new String(rev);
    }
}
